import axiosData from "@/api/axios";

export default {
  /**
   * @description:查询所有设备类型
   * @return {Array}
   */
  queryTree(params) {
    // return axiosData.get("/v3/agricultural-equipment/v1/equipmentType/queryAll", params);
    return axiosData.get(`/v3/agricultural-equipment/v1/equipmentType/queryAllNew?organization=${sessionStorage.organizationNo}&farming=${sessionStorage.farming}`, { ...params });
  },
  /**
   * @description:查询不可以删除的设备类型
   * @return {Array}
   */
  queryUndelete(params) {
    return axiosData.get("/v3/agricultural-equipment/v1/equipmentType/queryUndelete", params);
  },
  /**
   * @description: 新增设备类型
   * @param {Object} params *
   * @return {Object}
   */
  add(params) {
    return axiosData.post("/v3/agricultural-equipment/v1/equipmentType/add", { ...params, organizationNo: sessionStorage.organizationNo });
  },
  /**
   * @description: 编辑设备类型
   * @param {Object} params *
   * @return {Object}
   */
  edit(params) {
    return axiosData.post("/v3/agricultural-equipment/v1/equipmentType/edit", { ...params, organizationNo: sessionStorage.organizationNo });
  },
  /**
   * @description: 批量删除设备类型
   * @param {Object} params *
   * @return {Object}
   */
  delList(params) {
    return axiosData.post("/v3/agricultural-equipment/v1/equipmentType/deleteAll", params);
  },
  /**
   * @description: 检测设备类型名称是否已被占用
   * @param {Object} params *
   * @return {Object}
   */
  queryBeOccupied(params) {
    return axiosData.get(`/v3/agricultural-equipment/v1/equipmentType/queryBeOccupied?equTypeName=${params}`);
  },
  /**
   * @description:查询所有顶级
   * @return {Array}
   */
  queryTopAll() {
    return axiosData.get(`/v3/agricultural-equipment/v1/equipmentType/queryTopAllByOrganizationNo?organizationNo=${sessionStorage.organizationNo}`);
  },
  /**
   * @description:查询子集
   * @return {Array}
   */
  querySubAll(params) {
    return axiosData.get(`/v3/agricultural-equipment/v1/equipmentType/querySubAll?equipmentTypeCode=${params}`);
  }
};
